/**
 * 
 */
package ssdi.carrentalsystem.model;


import java.util.List;


import ssdi.carrentalsystem.dao.ViewCatalogDAO;
import ssdi.carrentalsystem.io.CarsIO;
import ssdi.carrentalsystem.utils.UserMessages;

/**
 * @author Ganta Mounica
 * 
 * The View Catalog Model class is invoked by ViewCatalogController servlet.This model
 * invokes the database to get the list of all cars in catalog
 *
 */
public class ViewCatalogModel {
	/*
	 * Retrieves a list of all cars currently in catalog 
	 * If results are found return list of carsIO objects, Else throw an exception.
	 * 	
	 */
	public List<CarsIO> performBasicSearch(List<CarsIO> basicSearchResults) throws Exception {
		basicSearchResults = ViewCatalogDAO.PerformBasicCarSearch(basicSearchResults);
		if(basicSearchResults != null) {
			return basicSearchResults;
		} else {
			System.out.println("In else partof view catalog model");
			throw new Exception(UserMessages.DATA_NOT_FOUND_IN_SEARCH);
		}
	}
}
